Mechanical changes to build on Linux. Most were just hyper const-ipation.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 13 Jan 2013 23:37:20 +0000 (23:37 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 13 Jan 2013 23:37:20 +0000 (23:37 +0000)
--This line, and those below, willignored--

M    gpsbabel/jeeps/gpsusbstub.cc
M    gpsbabel/xcsv.cc
M    gpsbabel/geo.cc
M    gpsbabel/hsa_ndv.cc
M    gpsbabel/rgbcolors.cc
M    gpsbabel/magproto.cc
M    gpsbabel/gopal.cc
M    gpsbabel/pathaway.cc
M    gpsbabel/delbin.cc
M    gpsbabel/tef_xml.cc
M    gpsbabel/ozi.cc

gpsbabel/delbin.cc
gpsbabel/geo.cc
gpsbabel/gopal.cc
gpsbabel/hsa_ndv.cc
gpsbabel/jeeps/gpsusbstub.cc
gpsbabel/magproto.cc
gpsbabel/ozi.cc
gpsbabel/pathaway.cc
gpsbabel/rgbcolors.cc
gpsbabel/tef_xml.cc
gpsbabel/xcsv.cc

index 16f6d4d9b83bceaf5b96119f4dc24bcec7ee5423..5cf76a0dff6dfb17ba7cab8fbdee09b90aa09892 100644 (file)
@@ -2947,7 +2947,7 @@ linuxhid_os_packet_write(const void* buf, unsigned size)
 {
   struct hiddev_usage_ref_multi urefm;
   struct hiddev_report_info rinfo;
-  const gbuint8* p = buf;
+  const gbuint8* p = (const gbuint8*) buf;
   unsigned i;
 
   for (i = 0; i < size; i++) {
index c897613a1ff019eb2a61965fa768fe8e6a11525b..a6c2d0f42b2628353e4cf91cab9fce7af82e5528 100644 (file)
@@ -100,7 +100,7 @@ void wpt_name_s(const char* args, const char** attrv)
 
 void wpt_name(const char* args, const char** unused)
 {
-  char* s;
+  const char* s;
   if (!args) {
     return;
   }
@@ -111,7 +111,9 @@ void wpt_name(const char* args, const char** unused)
     waypt_alloc_gc_data(wpt_tmp)->placer = xstrdup(s + 4);
 
     if (nuke_placer) {
-      *s = '\0';
+      // Sleaze alert.  We're casting away constness and writing into a string
+      // that should probably be read-only...
+      *(char *)s = '\0';
     }
   }
 }
@@ -155,7 +157,7 @@ void wpt_coord(const char* args, const char** attrv)
 
 void wpt_container(const char* args, const char** unused)
 {
-  int v;
+  geocache_container v;
 
   if (!args) {
     return;
index 01fc35c8a364e1571ce44ae86d8aef3597f6e6cc..869ae859e6a98d3fe555b4b857bf5640a0f85cc2 100644 (file)
@@ -102,7 +102,7 @@ gopal_rd_init(const char* fname)
 {
   char buff[32];
   char* ck;
-  char* filename;
+  const char* filename;
   CHECK_BOOL(optclean);
   if (optminspeed) {
     minspeed=atof(optminspeed);
index 9eec3bf6f606d6f8f9e0dc181c8cc8b4c3470259..21b9b4f71525688d2e623aa90f3e8b8ec50e78c7 100644 (file)
@@ -211,9 +211,9 @@ hsa_ndv_read(void)
 
 static void getAttr(const char* data, const char* attr, char** val, char seperator)
 {
-  char* start;
+  const char* start;
   if ((start = strstr(data, attr)) != NULL) {
-    char* end;
+    const char* end;
     int len;
 
     end = strchr(start, seperator);
index bf4fe7cf8d4b857078cbb3236e9e70d941d5190d..28fc39d2a408f4da54d2e6637565a484017d6c66 100644 (file)
@@ -29,9 +29,9 @@
 #if !HAVE_LIBUSB
 
 const char no_usb[] = "USB support is not available in this build.\n";
-
+typedef struct gpsdevh gpsdevh;
 int
-gusb_init(const char* portname)
+gusb_init(const char* portname, gpsdevh** dh)
 {
   fatal(no_usb);
   return 0;
index 8b2e1afa4c561c7cb6011b6a9b4d9690144a424d..ae3047ed623603d40df5ce18d6b3c822c112f70c 100644 (file)
@@ -619,8 +619,8 @@ mag_dequote(char* ibuf)
     int nremains = strlen(esc);
     if (nremains >= 3) {
       static const char hex[17] = "0123456789ABCDEF";
-      char* c1 = strchr(hex, esc[1]);
-      char* c2 = strchr(hex, esc[2]);
+      const char* c1 = strchr(hex, esc[1]);
+      const char* c2 = strchr(hex, esc[2]);
       if (c1 && c2) {
         int escv = (c1 - hex) * 16 + (c2 - hex);
         if (escv == 255) {     /* corrupted data */
@@ -768,7 +768,7 @@ mag_serial_init_common(const char* portname)
 static void
 mag_rd_init_common(const char* portname)
 {
-  char* ext;
+  const char* ext;
   waypoint_read_count = 0;
   // For Explorist GC, intercept the device access and redirect to GPX.
   // We actually do the rd_init() inside read as we may have multiple
index 449ddf75ca6f0aa0b3ab1f189e0d58ec06b01d3a..90632a7ceecf15f8db4c122b64ec68e6686108d6 100644 (file)
@@ -162,7 +162,7 @@ void
 ozi_set_time_str(const char *str, waypoint *waypointp)
 {
   double ozi_time;
-  char *dot;
+  const char *dot;
   int len;
 
   ozi_time = atof(str);
index e88b3acaae66d51c92312aab13e33e0229548e97..9a4bc9142f5d92f08440e1c857bfcfdf1c62da6f 100644 (file)
@@ -132,10 +132,11 @@ internal_debug2(const char *format, ...)
  */
 
 static
-char *ppdb_strcat(char *dest, char *src, char *def, int *size)
+char *ppdb_strcat(char *dest, const char *src, char *def, int *size)
 {
   int len;
-  char *res, *tmp;
+  char *res;
+  const char *tmp;
 
   tmp = src;
   if (tmp == NULL) {
@@ -284,7 +285,7 @@ double ppdb_decode_coord(const char *str)
     CHECK_INP(1, sscanf(str,"%lf", &val), "decode_coord(1) DD.dddd", str);
     return val;
   } else {
-    char *tmp;
+    const char *tmp;
 
     if (*str == 'O') {
       german_release = 1;
index 9e523fc96b0d7aca075508bf83a69f48698d6de2..4ad45e67d9e15eee5652f7076c0a95f315eff4f5 100644 (file)
@@ -191,7 +191,7 @@ static int HexDigit(char hex)
 {
   const char *Digits = "0123456789ABCDEF";
   const char *digits = "0123456789abcdef";
-  char * ofs = strchr(digits, hex);
+  const char *ofs = strchr(digits, hex);
   if (ofs) {
     return ofs-digits;
   }
index 047788450666730facff08dc24b124208a9bd9ed..ab5244d826ad83bce2805d0d8b75cb1de4b479d9 100644 (file)
@@ -161,7 +161,8 @@ tef_list_start(const char *args, const char **attrv)
 static char *
 fix_notes(const char *name, char *notes)
 {
-  char *cleft, *cright, *cback, *ctmp;
+  const char *cleft, *cright, *cback;
+  char *ctmp;
 
   if ((! name) || (! notes)) {
     return notes;
@@ -287,19 +288,24 @@ tef_point(const char *args, const char **attrv)
     return;
   }
 
+  // FIXME: this code should really not be writing into the arg list.
   while (*avp) {
     if (strcmp(avp[0], "y") == 0) {
-      comma = strstr(avp[1], ",");
+      char *tbuf = xstrdup(avp[0]);
+      comma = strstr(tbuf, ",");
       if (comma) {
         *comma='.';
       }
-      sscanf(avp[1], "%lf", &wpt_tmp->latitude);
+      sscanf(tbuf, "%lf", &wpt_tmp->latitude);
+      xfree(tbuf);
     } else if (strcmp(avp[0], "x") == 0) {
-      comma = strstr(avp[1], ",");
+      char *tbuf = xstrdup(avp[1]);
+      comma = strstr(tbuf, ",");
       if (comma) {
         *comma='.';
       }
-      sscanf(avp[1], "%lf", &wpt_tmp->longitude);
+      sscanf(tbuf, "%lf", &wpt_tmp->longitude);
+      xfree(tbuf);
     }
     avp+=2;
   }
index 10ff19fb2141f9b4adc44b5320c8051efdb54c60..56ccfc364539675873e7988b79f9d087be400eca 100644 (file)
@@ -224,10 +224,11 @@ xcsv_get_char_from_constant_table(char *key)
 }
 
 static void
-xcsv_parse_style_line(const char *sbuff)
+xcsv_parse_style_line(char *sbuff)
 {
   int i, linecount = 0;
-  char *s, *p, *sp;
+  char *s, *sp;
+  char *p;
   const char *cp;
   char *key, *val, *pfc;